import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '类型',
    align: 'center',
    dataIndex: 'type_dictText',
    ellipsis: true,
  },
  {
    title: '名称',
    align: 'center',
    dataIndex: 'name',
    ellipsis: true,
  },
  {
    title: '日期',
    align: 'center',
    dataIndex: 'dynamicTime',
    ellipsis: true,
  },
  {
    title: '描述',
    align: 'center',
    dataIndex: 'content',
    ellipsis: true,
  },
  {
    title: '活动图',
    align: 'center',
    dataIndex: 'fileList',
  },
  {
    title: '状态',
    align: 'center',
    dataIndex: 'status_dictText',
  },
  {
    title: '序号',
    align: 'center',
    dataIndex: 'seq',
  },
];
export const statusOptions = [
  { label: '生效', value: '1' },
  { label: '失效', value: '0' },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '类型',
    field: 'type',
    component: 'JDictSelectTag',
    colProps: { span: 8 },
    componentProps: () => {
      return {
        dictCode: 'dynamic_type',
      };
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'Select',
    componentProps: {
      options: statusOptions,
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '类型',
    field: 'type',
    component: 'Input',
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '日期',
    field: 'dynamicTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '描述',
    field: 'content',
    component: 'InputTextArea',
  },
  {
    label: '状态',
    field: 'status',
    component: 'Input',
  },
  {
    label: '序号',
    field: 'seq',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  type: { title: '类型', order: 0, view: 'text', type: 'string' },
  name: { title: '名称', order: 1, view: 'text', type: 'string' },
  dynamicTime: { title: '日期', order: 2, view: 'datetime', type: 'string' },
  content: { title: '描述', order: 3, view: 'textarea', type: 'string' },
  status: { title: '状态', order: 4, view: 'text', type: 'string' },
  seq: { title: '序号', order: 5, view: 'number', type: 'number' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
